<!DOCTYPE html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
  <title>树形菜单示例</title>
  <style type="text/css">
    ul>li{
      list-style: none;
    }
    /* 可展开*/
    .switch-open
    {
      margin-left:-12px;
      border:6px solid transparent;
      display:inline-block;
      width:0px;
      height:0px;
      border-top-color: black;
    }
    /* 展开完毕*/
    .switch-close
    {
      margin-left:-12px;
      border:6px solid transparent;
      display:inline-block;
      width:0px;
      height:0px;
      border-left-color: black;
      margin-bottom: 2px;
    }
    /* 改变CheckBox样式*/
    input[type='checkbox']{
      width: 20px;
      height: 20px;
      -webkit-appearance:none;
      -moz-appearance: none;
      border: 1px solid #c9c9c9;
      border-radius: 3px;
      outline: none;
      color:white;
      text-align: center;
    }
    input[type='checkbox']:before
    {
      content: '√ ';
      color:transparent;
    }
    input[type=checkbox]:checked{
      background-color: #30add6;
    }
    input[type=checkbox]:checked:before{
      content: '√';
      color:white;
      font-weight: bold;
    }
    html, body {
      width: 100%;
      height: 100%;
      margin: 0;
      padding: 0;
      overflow: auto;
    }
  </style>
</head>
<body>
<!--<input type="button" onclick="dl()" value="确定">-->
<!--<iframe id="haha" name="haha" src="https://blog.csdn.net/dukai392/article/details/78298567"></iframe>-->
<!--<script>-->
    <!--$f=function(p){-->
        <!--return document.frames?document.frames[p]:$(p).contentWindow;-->
    <!--}-->
    <!--function dl()-->
    <!--{-->
        <!--alert($f("haha").document.body.innerHTML);-->
    <!--}-->
<!--</script>-->

<div id="html"></div>
<div>
  这里放置自定义内容
</div>
</body>
<script type="text/javascript" src="http://libs.baidu.com/jquery/1.7.2/jquery.min.js"></script>
<script>
    var Timer={
        data:{},
        start:function(key){
            Timer.data[key]=new Date();
        },
        stop:function(key){
            var time=Timer.data[key];
            if(time)
                Timer.data[key]=new Date()-time;
        },
        getTime:function(key){
            return Timer.data[key];
        },
        showByKey:function (key) {
            console.log(key + '耗时：'+Timer.getTime(key)+'ms');
        }
    };
    // test
    // Timer.start("div");
    // for(var i=0;i<count;i++){
    //     document.createElement("div");
    // }
    // Timer.stop("div");
    // console.log("the time is:"+Timer.getTime());

  function getTitle(str){
      Timer.start("getTitle");
      str   =   str.replace(/\s+/g,"");
      //去除换行
      str = str.replace(/[\r\n]/g,"");
      var match1 = /(\S*)\<\/title\>/;
      var match2 = /\<title\>(\S*)/;
      //截取指定字符之前的字符串
      var zhiqian_string = str.match(match1);
      //截取指定字符之后的字符串
      var title = zhiqian_string[1].match(match2);
      Timer.stop("getTitle");
      Timer.showByKey('getTitle');
      return title[1];
  }

  function getKeywords(Obj){
      // var Obj = $("<code></code>").append($(str));//包装数据
      //(需要获取的对应块（如class='aa')
      var $html1 = $("[name=keywords]", Obj);
      var keyword = $html1.attr('content');
      if (typeof(keyword) == "undefined")
      {
          $html1 = $("[name=Keywords]", Obj);
          keyword = $html1.attr('content');
      }
      if (typeof(keyword) == "undefined") {
          return "";
      }else{
          return keyword;
      }
  }

  function getDesc(Obj){
      var $html = $("[name=description]", Obj);
      var desc = $html.attr('content');
      if (typeof(desc) == "undefined")
      {
          $html = $("[name=Description]", Obj);
          desc = $html.attr('content');
      }
      if (typeof(desc) == "undefined") {
          return "";
      }else{
          return desc;
      }
  }

    $.ajaxPrefilter(function (options) {
        if (options.crossDomain && jQuery.support.cors) {
            var http = (window.location.protocol === 'http:' ? 'http:' : 'https:');
            options.url = http + '//cors-anywhere.herokuapp.com/' + options.url;
            //options.url = "http://cors.corsproxy.io/url=" + options.url;
        }
    });


    var url = 'http://www.php.cn/js-tutorial-384169.html';
    // url = 'https://www.jianshu.com/u/6b02b09fcd14';
    url = 'http://www.p8e.cn/Article/article/16.html';
    url = 'https://www.cnblogs.com/thiaoqueen/p/6904398.html';
    //https://blog.csdn.net/dukai392/article/details/78298567
    //https://mp.weixin.qq.com/s/vUaCwSEIYlGpf1yZ0HdNCw
    //https://blog.csdn.net/qq_24734285/article/details/80203784
    //http://www.php.cn/js-tutorial-384169.html
    Timer.start("get");
    // console.profile("get");

    $.get(
        url,
        function (response) {
            Timer.stop("get");
            Timer.showByKey('get');
            // // console.profileEnd("get");
            // // $("#html").html(response);
            // var str = response;
            // console.log(getTitle(str));
            Timer.start('code');
            var Obj = $("<code></code>").append($(response));//包装数据
            var desc = getDesc(Obj);
            var keyword = getKeywords(Obj);
            console.log('desc: ' + desc);
            console.log('keyword: ' + keyword);
            //(需要获取的对应块（如class='aa')
            // var $html1 = $("[name=keywords]", Obj);
            // var keyword = $html1.attr('content');
            // if (typeof(keyword) == "undefined")
            // {
            //     $html1 = $("[name=Keywords]", Obj);
            //     keyword = $html1.attr('content');
            // }
            // console.log('keyword: ' + keyword);
            //
            // var $html = $("[name=description]", Obj);
            // var desc = $html.attr('content');
            // if (typeof(desc) == "undefined")
            // {
            //     $html = $("[name=Description]", Obj);
            //     desc = $html.attr('content');
            // }
            // console.log('desc: ' + desc);

            var title = getTitle(response);
            console.log('title: ' + title);

            Timer.stop("code");
            Timer.showByKey('code');

        });

    // Timer.start("load");
    // $("#html").load(url+" title");
    // Timer.stop("load");
    // Timer.showByKey('load');

</script>

<script src="http://cdn.amazeui.org/amazeui/2.7.2/js/amazeui.widgets.helper.min.js"></script>
<!--[if lt IE 9]>
<script src="http://libs.baidu.com/jquery/1.11.1/jquery.min.js"></script>
<script src="http://cdn.staticfile.org/modernizr/2.8.3/modernizr.js"></script>
<script src="__ASSETS__/js/amazeui.ie8polyfill.min.js"></script>
<![endif]-->

<!--[if (gte IE 9)|!(IE)]><!-->
<script src="__ASSETS__/js/jquery.min.js"></script>
<!--<![endif]-->
<script src="__ASSETS__/js/amazeui.min.js"></script>

<script src="__ASSETS__/js/jquery.cookie.min.js"></script>
<!--<script src="__ASSETS__/js/jquery.min.js"></script>-->
<!--<script src="//cdn.bootcss.com/jquery-cookie/1.4.1/jquery.cookie.min.js"></script>-->
<script src="__ASSETS__/js/common.js"></script>



</body>
</html>